#ifndef __SERVER_H__
#define __SERVER_H__

#include "pthreadpool.h"
#include "xmlParse.h"
#include "parseMessage.h"
#include "common.h"

//typedef void(*HANDLESOCK)(int, int);


class Server 
{
public:
    Server();
    ~Server();

    bool init(size_t port = 9090);
    bool loadServerConfig();
    void start();
    void handleEpoll(struct epoll_event* evts, int size);

	//事件处理
    static void handleSock(void* ptr);
	static void handleEvent(void* ptr);
	static void handleInEvent(void* ptr);
	static void handleInETEvent(void* ptr);
    static void handleOutEvent(void* ptr);
private:
    int epoll_fd_;

    int sock_fd_;
  
    ThreadPool* tp_;

    qXmlParse xml;
    std::string configfile_;//

    std::string logstr_;
    std::string logpath_;
    //std::string logfile_;//读配置文件目录
    std::string sqlurl_;
    std::string serverlog_file_;//写日志目录
    uint32 maxmysql_num_;
    uint32 maxmysql_timeout_;
    uint32 threadnum_;
    uint32 maxthreadnum_;
};


#endif
